<?php
/**
* エラーチェッククラス
**/


require_once( '../system/Class_M_DAO.php' );
class Class_B_HISTORY extends Class_M_DAO {
	//protected properties begin
	/**
	 *
	 * テーブル名
	 *
	 * @access    protected
	 * @var       string
	 *
	 */
	protected $_table = "B_HISTORY";
	
	/**
	 *
	 * 主キー名
	 *
	 * @access    protected
	 * @var       string
	 *
	 */
	protected $_pkey = "id";
	
	/**
	 *
	 * ソート順
	 *
	 * @access    protected
	 * @var       string
	 *
	 */
	 protected $_order = "id desc";
	 
	 
	 protected $_cols     = array(
	 );
	
	
	 protected $_checks  = array(
	 );
	 
	 //maxlength 
	 protected $_maxlens  = array(
	 );
	 
	 //errors
	 protected $_errs  = array();
	 
	 public function push_msg_error( $val ) {
	 	$this ->_errs[] = $val;
	 }
	 public function pop_msg_error( $val ) {
	 	$strErr =  implode(' <br> ', $this ->_errs) ;
	 	
	 	return  $strErr;
	 }
	 public function write_msg_succed( $line ) {
	 	$strErr =  "｛$line｝件データをインポートしました";
	 	echo $strErr;
	 }
	 public function write_bhistory( $values ) {
	 	
	 	$fields = sprintf("'%s' ,'%s' ,'%s' ,'%s' ,'%s' ,'%s' ,CURRENT_TIMESTAMP ,'%s' ",
	 	$values["matrix_cd"],$values["sort"],$values["start_time"],$values["end_time"],$values["result_flg"],$this->_db->quote($values["result_msg"]),$values["u_user"]);
	 	
	 	$sql ="insert into B_HISTORY(matrix_cd, sort, start_time, end_time, result_flg, result_msg, u_time, u_user) values(" . $fields .")";
	 	try {
			if ($this->_db->query( $sql )) {
				$id = $this->_db->last_id();
				return $id;
			} else {
				return FALSE;
			}
		} catch (Exception $e) {
			echo "例外キャッチ：", $e->getMessage(), "\n";
			return FALSE;
		}
	 	
	 }

}

?>